package cn.gson.crmdemo.controller.table;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.gson.crmdemo.model.service.CaiGouBaoBiaoService;

@Controller
public class CaiGouBaoBiaoController {

	@Autowired
	CaiGouBaoBiaoService cg;
	
	@RequestMapping("log-json2")
	@ResponseBody
	public  Map<String, Object> logjson(Integer page,Integer pageSize) {
		Page<Object> pages = PageHelper.startPage(page,pageSize);
		JSONArray list = cg.selectAlltt();
		long total =  pages.getTotal();
		Map<String, Object> map = new HashMap<>();
		map.put("list", list);
		map.put("total", total);
		return map;
	}
	
	@RequestMapping("log-json123")
	@ResponseBody
	public JSONArray log() {
		return cg.select();
	}
}
